//: Playground - noun: a place where people can play

import UIKit

//// MARK: - 过滤指定字符串   里面的指定字符根据自己的需要添加
//func RemoveSpecialCharacter(_ str: String) -> String {
//
//    let range = str.rangeOfCharacter(from: CharacterSet(charactersIn: "-,.？、% ~￥#&<>《》()[]{}【】^@/￡¤|§¨「」『』￠￢￣~@#&*（）——+|《》$_€"))
//    if range != nil {
//        return RemoveSpecialCharacter(str.replacingCharacters(in: range!, with: ""))
//    }
//    return str
//}
//
//extension String {
//    func trim() -> String {
//        //        return self.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
//        return self.trimmingCharacters(in: NSCharacterSet.whitespaces)
//    }
//}
//
//func chineseConversionPinYin(_ str:String)->String{
//    let strpinyin = NSMutableString(string:str) as CFMutableString
//    if CFStringTransform(strpinyin, nil, kCFStringTransformMandarinLatin, false){
//        if CFStringTransform(strpinyin, nil, kCFStringTransformStripDiacritics, false){
//            return strpinyin as String
//        }
//    }
//    print("\(str)---------无法转换成拼音-----")
//    return ""
//}
//
////var str = "  Hello, play    ground    "
//let whitespace = NSCharacterSet.whitespacesAndNewlines
////str = str.stringByTrimmingCharactersInSet(whitespace)
//
//var str = " 啥都,.？、% ~￥#&<>是 h,.？、% ~￥#&<>el,.？、% ~￥#&<>lo, - - <> ^%#*()%#@$%&^$(()( playground"
//
//var strArray = ["Avcv","到","谁","的","ssadasd","dsdWsa","Bxczx","到地方","Cvv","dsdasdsas","Dczxc","Tzcs","adsadas"]
//// 去除两端空格和回车
//str = str.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
//str = RemoveSpecialCharacter(str)
//// 判断首字符是否为字母
//let strrr = "sssss"
//let sssss = strrr.replacingOccurrences(of: "'", with: "")
//let regex = "[A-Za-z]+"
//let predicate = NSPredicate.init(format: "SELF MATCHES %@",regex)
//
//
//strArray.min()
//strArray.max()
//
//strArray.suffix(2)
//strArray.prefix(2)
//var ddd = str.characters.index(of: "o")
////var number = Int(String(describing: ddd!.successor()))
//var sss = String(str.characters.dropFirst(4))
//
//strArray.sort(by: <)
//strArray.sorted(by: >)
////str.uppercased
//
//String(describing: str.characters.first)
//
//print(str.capitalized)
//
//strArray.enumerated()
//
//let singlePinyinLetter = str.capitalized.characters.first
//
//for i in 0 ..< str.characters.count{
//    print(i)
//}
//
//for character in "Dog".characters {
//
//    print(character)
//}
//
//"Dog".characters.contains("g")
//
//var str1 = "我饿"
//
//chineseConversionPinYin(str1)
//
//strArray.insert("sss", at: 0)
//
//strArray.removeLast()


//let online = "1.7.8"
//let local = "1.8.9"
//
//// true 代表需要更新 false 代表出错了/或者不用更新
//func compareVersionCanUptade(online: String,local: String) -> Bool {
//    let stringArray0 = online.components(separatedBy: ".")
//    let stringArray1 = local.components(separatedBy: ".")
//    for num in stringArray0.enumerated() {
//        if num.offset > stringArray1.count - 1 {return true}
//        let a = Int(num.element)!
//        let b = Int(stringArray1[num.offset])!
//        while a != b {return a > b}
//    }
//    if stringArray0.count < stringArray1.count {return false}
//    return false
//}
//
//let status =  compareVersionCanUptade(online: online, local: local)






























